#include <iostream>

#include "Commander.h"


Commander commander("***");

Command cmd1("cmd1", &commander, [](Command *cmd) {

    std::printf("cmd1 callback :%s\n", cmd->data);

//    cmd->pushResult("%s", cmd->data);

});

Command cmd2("cmd2", &commander, [](Command *cmd) {

    std::printf("cmd2 callback :%s\n", cmd->data);

    cmd->pushResult("%s", cmd->data);

});

int main() {
    setbuf(stdout, NULL);
    char fram[32];
    char ret[128];

    sprintf(fram, "%s", "#@!cmd1=hh\n");
    commander.parse(fram);
    commander.getResult(ret, 128);
    std::printf("%s", ret);


    sprintf(fram, "%s", "#@!cmd2=h\n");
    commander.parse(fram);
    commander.getResult(ret, 128);
    std::printf("%s", ret);
    return 0;
}

